# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
pkgname=lua-lupa
_rockname=${pkgname#lua-}
pkgver=1.0
pkgrel=0
_gittag=${_rockname}_$pkgver
pkgdesc="Jinja2 template engine implementation written in Lua"
url="https://orbitalquark.github.io/lupa/"
arch="noarch"
license="MIT"
depends="lua-lpeg"
checkdepends="lua5.1"
source="$pkgname-$pkgver.tar.gz::https://github.com/orbitalquark/lupa/archive/$_gittag.tar.gz"
builddir="$srcdir/$_rockname-$_gittag"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	provides="$provides lua$_v-$_rockname=$pkgver-r$pkgrel"
done

check() {
	make tests
}

package() {
	install -m 644 -D lupa.lua "$pkgdir"/usr/share/lua/common/lupa.lua

	local rockdir=$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1
	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="
ecb4a71d78b5a1786dfc5f34071be0718d54cba1b11dc35edff5f1a3d232db076ebf2ad1d4956cfd1eb036b5ce9f60ef5327f08905ebde14702a92798052630e  lua-lupa-1.0.tar.gz
"
